package com.meritdata.cloud.data.standard.desensitization.dao;

import com.meritdata.cloud.data.standard.desensitization.entity.TdDatamaskRule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import javax.transaction.Transactional;
import java.util.Date;

public interface IMaskDao extends JpaRepository<TdDatamaskRule,Long>, QuerydslPredicateExecutor<TdDatamaskRule> {
    @Modifying
    @Transactional
    @Query("update TdDatamaskRule as c set c.name=:name ,c.updateTime=:updateTime,c.config=:config,c.example=:example,c.description=:description where c.id=:id")
    int update(Long id, String name, String config, String example, String description, Date updateTime);
    @Modifying
    @Transactional
    @Query("update TdDatamaskRule as c set c.enable=:enable  where c.id=:id")
    int updateEnable(Long id, Integer enable);
}
